package com.mfs.proxy.core.server.registry;

import com.mfs.proxy.core.server.config.ServerConfig;

/**
 * 代理客户端注册中心 单例工厂
 *
 * @author mfs
 * @date 2023/7/2 2:17
 **/
public class ProxyClientRegistrySingletonFactory {
    private static ProxyClientRegistry proxyClientRegistry;
    static {
        try {
            Class<?> aClass = Class.forName(ServerConfig.getInstance().getProxyClientRegistry(), true, Thread.currentThread().getContextClassLoader());
            proxyClientRegistry = (ProxyClientRegistry)aClass.newInstance();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        }
    }

    public static ProxyClientRegistry getProxyClientRegistry() {
        return proxyClientRegistry;
    }
}
